<?php
require('db_and_modx_init.php');
require('feed.inc.php');

$article_id = mysql_real_escape_string($_POST['article_id']);
$doc_id = mysql_real_escape_string($_POST['doc_id']);
$query = "INSERT INTO articleFeeds (articleId, pageId) VALUES ('$article_id', '$doc_id')";


$result = $modx->db->query($query);
// mysql_close();  //technically unnecessary

if (!$result) {
    $message  = 'Invalid query: ' . mysql_error() . "\n" . $query;
    die($message);
}

class returnData {
	var $status = '200', $tdData;
	
	function __construct(){
		global $article_id;
		 $this->tdData = make_publish_links($article_id);
	}
}

$resp = new returnData();

echo json_encode($resp);
?>